#!/usr/bin/perl

sub gcd {
	my $a = $_[0];
	my $b = $_[1];
	while ($a != $b) {
		if ($a > $b) {
			$a = $a - $b;
		} else {
			$b = $b - $a;
		}
  	}
	$a;
}

print gcd(2,14) . "\n";
print gcd(3,15) . "\n";
print gcd(99,121) . "\n";
